using System;
using System.Web.Mvc;
using System.Web.Routing;
using StructureMap;

namespace Dgg.Anug.Cqrs.Core.Infrastructure.Web
{
	public class CustomControllerFactory : DefaultControllerFactory
	{
		protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
		{
			return controllerType == null ?
				base.GetControllerInstance(requestContext, controllerType) :
				ObjectFactory.GetInstance(controllerType) as Controller;
		}
	}
}